package gfx.tiles;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

/**
 * 
 * This class includes all images for tiles.
 * 
 * @author lueko.voss
 *
 */
public class TileGraphics {

    public int WIDTH;
    public int HEIGHT;
    public BufferedImage image;
    
//    public static final TileGraphics tank = new TileGraphics(32, 32, 0, 0, Spritesheet.sheet);
    public static final TileGraphics err = new TileGraphics(32, 32, Color.BLACK);
    
//    public static final TileGraphics sand = new TileGraphics(32, 32, 1, 0, Spritesheet.sheet);
//    public static final TileGraphics grass = new TileGraphics(32, 32, 5, 0, Spritesheet.sheet);
    
    public static final TileGraphics grass = new TileGraphics(32, 32, 0, 0, Spritesheet.tileset);
    public static final TileGraphics wall = new TileGraphics(32, 32, 1, 0, Spritesheet.tileset);
    public static final TileGraphics stone = new TileGraphics(32, 32, 6, 20, Spritesheet.tileset);
    public static final TileGraphics water = new TileGraphics(32, 32, 0, 4, Spritesheet.tileset);
    public static final TileGraphics sand = new TileGraphics(32, 32, 9, 10, Spritesheet.tileset);
    
    /**
     * Creates a TileGraphics object with an image.
     * 
     * @param WIDTH Width of the tile image.
     * @param HEIGHT Height of the tile image.
     * @param x X position of the tile image in the spritesheet.
     * @param y Y position of the tile image in the spritesheet.
     * @param sheet Spritesheet which includes the image fo he tile.
     */
    public TileGraphics(int WIDTH, int HEIGHT, int x, int y, Spritesheet sheet) {
        this.WIDTH = WIDTH;
        this.HEIGHT = HEIGHT;
        image = sheet.images[x][y];
    }
    
    /**
     * Creates a TileGraphics object with a given color.
     * 
     * @param WIDTH Width of the tile image.
     * @param HEIGHT Height of the tile image.
     * @param color Color of the tile image.
     */
    public TileGraphics(int WIDTH, int HEIGHT, Color color) {
        this.WIDTH = WIDTH;
        this.HEIGHT = HEIGHT;
        image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
        Graphics g = image.createGraphics();
        g.setColor(color);
        g.fillRect(0, 0, WIDTH, HEIGHT);
    }
    
}
